/**
 * Copyright © 2018,  Network Co.,Ltd. All rights reserved.  PROPRIETARY/CONFIDENTIAL. Use is subject to
 * license terms.
 */
package com.james.sms.conf;

import com.github.qcloudsms.SmsMultiSender;
import com.github.qcloudsms.SmsSingleSender;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * ClassName:com.james.sms Description: ${DESCRIPTION}
 *
 * Date: 2018/7/6 17:55
 *
 * @author James
 * @version 1.0.0
 */
@Configuration
@EnableConfigurationProperties({QCloudSmsProperties.class, QCloudSmsTestProperties.class})
public class QCloudSmsConfig {

    private final QCloudSmsProperties qCloudSmsProperties;
    private final QCloudSmsTestProperties qCloudSmsTestProperties;

    public QCloudSmsConfig(QCloudSmsProperties qCloudSmsProperties, QCloudSmsTestProperties qCloudSmsTestProperties) {
        this.qCloudSmsProperties = qCloudSmsProperties;
        this.qCloudSmsTestProperties = qCloudSmsTestProperties;
    }

    @Bean(name = "defaultSmsSingleSender")
    public SmsSingleSender getSmsSingleSender() {
        return new SmsSingleSender(qCloudSmsProperties.getAppid(), qCloudSmsProperties.getAppkey());
    }

    @Bean(name = "defaultSmsMultiSender")
    public SmsMultiSender getSmsMultiSender() {
        return new SmsMultiSender(qCloudSmsProperties.getAppid(), qCloudSmsProperties.getAppkey());
    }


}
